﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using WCSY.BLL;

public partial class CostsManagement_ClaManagement_costsQuery : System.Web.UI.Page
{
    Fg_deptInfoManager deptM = new Fg_deptInfoManager();
    costsQueryManager querM = new costsQueryManager();
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack){
            //绑定申请部门
            DataTable deptList = deptM.GetAllList().Tables[0];
            this.ddlApplyDept.DataSource = deptList;
            this.ddlApplyDept.DataTextField = "deptname";
            this.ddlApplyDept.DataValueField = "id";
            this.ddlApplyDept.DataBind();
            //gvBind();
        }
    }

    public void gvBind() {

       
        string sysno = txtSysno.Text;
        string dept = ddlApplyDept.SelectedValue;
        string applypsn = txtApplyPsn.Text;
        string fillpsn = txtFillPsn.Text;
        string filldateB = txtFilldateB.Text;
        string filldateE = txtFilldateE.Text;
        string billtype = ddlBillType.SelectedValue;
        string businessDateB = txtBusinessdateB.Text;
        string businessDateE = txtBusinessdateE.Text;
        DataTable dt = querM.getAllCostQueryByBillType(billtype, dept, applypsn, businessDateB, businessDateE, fillpsn, filldateB, filldateE, sysno);
        this.GridView1.DataSource = dt;
        this.GridView1.DataBind();
    }

    protected void btnSec_Click(object sender, EventArgs e)
    {
        string sysno = txtSysno.Text;
        string dept = ddlApplyDept.SelectedValue;
        string applypsn = txtApplyPsn.Text;
        string fillpsn = txtFillPsn.Text;
        string filldateB = txtFilldateB.Text;
        string filldateE = txtFilldateE.Text;
        string billtype = ddlBillType.SelectedValue;
        string businessDateB = txtBusinessdateB.Text;
        string businessDateE = txtBusinessdateE.Text;
        DataTable dt = querM.getAllCostQueryByBillType(billtype, dept, applypsn, businessDateB, businessDateE, fillpsn, filldateB, filldateE, sysno);
        this.GridView1.DataSource = dt;
        this.GridView1.DataBind();
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Attributes.Add("onmouseover", "if(this!=prevselitem){this.style.backgroundColor='#Efefef'}");//当鼠标停留时更改背景色
            e.Row.Attributes.Add("onmouseout", "if(this!=prevselitem){this.style.backgroundColor='#ffffff'}");//当鼠标移开时还原背景色
            e.Row.Attributes.Add("onclick", "this.cells[0].childNodes[0].click();");//selectx(this);this.cells[1].childNodes[0].click();
            e.Row.Attributes.Add("ondblclick", "rowdblClick(" + e.Row.Cells[2].Text + ")");

        }
    }
}
